package com.lyj.book.controller;

import com.lyj.book.dao.mappper.BookUserMapper;
import com.lyj.book.dao.model.BookUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuyj
 * @create 2017-09-18 16:29
 **/
@RestController
@Slf4j
@Api("小说用户")
@RequestMapping("bookusers")
public class CustomerController {

    @Autowired
    private BookUserMapper bookUserMapper;

    /**
     * 添加小说用户
     *
     * @param bookUser
     * @return
     */
    @ApiOperation("添加小说用户")
    @PostMapping(value = "bookUser")
    public ResponseEntity postBookUser(@ModelAttribute BookUser bookUser){
        log.info("添加小说用户："+bookUser.toString());
        return new ResponseEntity(bookUserMapper.insert(bookUser),HttpStatus.OK);
    }




}
